package app

import (
	"fmt"

	"github.com/spf13/viper"
)

type Mysql struct {
	User     string
	Password string
	Host     string
	Port     int
	Dbname   string
}
type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}
type Upload struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Url       string
}
type AppConfig struct {
	Mysql  Mysql
	Redis  Redis
	Upload Upload
}

var App *AppConfig

func Init() {
	viper.SetConfigFile("../app/app.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&App)
	fmt.Println("配置文件", App)
}
